#!/usr/bin/env python
# Author: Derek Green

PKG = 'nltk_parser'

import roslib; roslib.load_manifest(PKG)
import rospy
from nltk_parser.srv import *

class Test():
    def __init__(self):
#        print "Testing Nltk Parser Service"
#        rospy.init_node('test_nltk_parser_node', anonymous=True)
#        rospy.wait_for_service('nltk_parse')
#        print "ENTERING TERMINAL INPUT MODE:"
#        try:
#            self.parse_nltk = rospy.ServiceProxy('nltk_parse', Parse)
#        except rospy.ServiceException, e:
#            print "ntlk_parse Failed: %s"%e
        print "Testing Nltk WW Interpreter Service"
        rospy.init_node('test_nltk_ww_interpreter_node', anonymous=True)
        rospy.wait_for_service('nltk_ww_interpret')
        try:
            self.interpret_nltk = rospy.ServiceProxy('nltk_ww_interpret', ParseInterpretation)
        except rospy.ServiceException, e:
            print "ntlk_ww_interpret Failed: %s"%e

if __name__ == '__main__':
    st = Test()
    while not rospy.is_shutdown():
        line = raw_input("Enter sentence: ")
        msg = st.interpret_nltk(line)
        print "message =\n%s"%msg
